package com.calsoft.Hops_Mobile_Tablet;
/*
 * User: Minh Diep
 * Date: 7/1/13
 * Time: 1:58 PM
 */

import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.calsoft.Hops_Mobile_Tablet.component.SimpleAlertDialogFragment;
import com.calsoft.Hops_Mobile_Tablet.dummy.Deal;
import com.calsoft.Hops_Mobile_Tablet.dummy.StaticData;

public class DealsDetailFragment extends Fragment {


    public DealsDetailFragment(){}

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        //Set up the view
        View view = inflater.inflate(R.layout.fragment_deals_detail, container, false);

        String key = getArguments().getString(DealsSectionsPagerAdapter.DEALS_SECTION_NUMBER, "deal_1");

        StaticData staticData = new StaticData();
        Deal deal = staticData.dealHashMap.get(key);

        ImageView dealIv = (ImageView) view.findViewById(R.id.deal_iv);
        TextView displayNameTv = (TextView) view.findViewById(R.id.deal_display_name_tv);
        TextView serviceNameTv = (TextView) view.findViewById(R.id.deal_service_name_tv);
        TextView priceTv = (TextView) view.findViewById(R.id.deal_price_tv);
        TextView bookNowBtn = (TextView) view.findViewById(R.id.deal_book_now_btn);

        String imageName = deal.getImageTag();
        int drawableImageId = getActivity().getResources().getIdentifier(imageName, "drawable", getActivity().getPackageName());
        dealIv.setImageResource(drawableImageId);

        displayNameTv.setText(deal.getDisplayName());
        serviceNameTv.setText(deal.getServiceName());
        priceTv.setText(deal.getPrice());

        return view;
    }
}
